﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using MySql.Data.MySqlClient;
using System.Configuration;

namespace QLXM.Common.models
{
    public class BaseModel
    {
        protected DataSet baseDs;
        /// <summary>
        /// Base Dataset properties
        /// </summary>
        public DataSet BaseDataSet
        {
            get
            {
                if (baseDs == null)
                {
                    baseDs = new DataSet();
                }
                return baseDs;
            }
            set
            {
                baseDs = value;
            }
        }

        public string GetTableColumnBinding(string tableName, string colName)
        {
            return tableName + "." + colName;
        }

        public int GetIdMax(string tableName, string computeString, string computerFilterString)
        {
            return Int32.Parse(baseDs.Tables[tableName].Compute(computeString, computerFilterString).ToString()) + 1;
        }
    }
}
